﻿
using System;
using System.Collections.Generic;
using System.Data.Entity;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using Database.Model;

namespace Database.infrastructure
{
    /// <summary>
    /// 对数据库上下文进行封装
    /// </summary>
    public class DatabaseFactory : IDatabaseFactory
    {
        private readonly BlogsEntities _dataContext;
        public DatabaseFactory(BlogsEntities dbContext)
        {
            _dataContext = dbContext;
        }

        public DbContext _dbContext => _dataContext;

        public IDbSet<T> Get<T>() where T : class
        {
            return _dataContext.Set<T>();
        }
    }
}
